package 测试案例;

import java.util.Scanner;

public class Test9 {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int dp = sc.nextInt();

        int left = zhishu(dp);//第一个质数
        int right = left;//第二个质数
        int max = left + right;
        int min = dp;
        int x = 0;//保留差点最小的质数
        int y = 0;;//保留差点最小的质数

        while(max >= dp){
            int tmp = right;
            while(max >= dp){
                if(max == dp &&  min > left - tmp){
                    min = left - tmp;
                    x = tmp;  y = left;
                    break;
                }
                tmp = zhishu(tmp);
                max = tmp + left;
            }

            left = zhishu(left);
            right = left;
            max = left + right;

        }

        System.out.println(x);
        System.out.println(y);
    }
    //传进来一个数，返回一个比这个数小的质数
    public static int zhishu(int a){
        if(a == 1) return 1;
        for(int i = a - 1; ; i--){
            if(pd_zhishu(i))return i;
        }
    }
    //判断这个数是不是质数
    public static boolean pd_zhishu(int a){
        for(int i = 2; i < a ; i++){
            if(a % i == 0)return false;
        }
        return true;
    }
}
